<?php
header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
    header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
    header( "Cache-Control: no-cache, must-revalidate" );
    header( "Pragma: no-cache" );
#error_reporting(0);
require_once "../Common/values.php";
require_once "../Common/database.php";
require_once "theme.php";


if($publiclock=='true')
{
echo '<center><H1>SYSTEM lOCKED!! '.$lockedreason.'</CENTER></H1>';
exit;
}
echo '<meta http-equiv="refresh" content="60" /><title>'.$title.' Dashboard</title>';


switch ($_POST[select])
{
#case ('');
#$_POST[line]='%';
#break;

case('');
$_POST[lognumber]='%';
$_POST[operator]='%';
$_POST[assigned]='%';
$_POST[requestor]='%';
$_POST[subject]='%';
$_POST[proirty]='%';
$_POST[status]='%';
$_POST[closed]='Open';
$_POST[line]='%';
$_POST[due]='%';
break;


}

switch ($_POST[closed])
{
case ("Closed");
$_POST[closed]='checked';
	break;
case ("Open");
$_POST[closed]='';
	break;
case ("");
$_POST[closed]='';
	break;
}
echo '<h3>'.$title.' Dashboard</h3><p>';

echo '<center><table><tr>';
echo '<FORM action="publicfilter.php" method="POST"><td style="border:0px solid ;" valign="top"><select name=select onchange="this.form.submit();"><option>All Open</option>';
genSelect();
echo '</select></td><td class="noborder"></form></td>';
echo '<FORM action="searchpublic.php" method="POST"><td style="border:0px solid;" valign="top">';
echo 'Log:<INPUT type="text" name="logsearch" size="10" maxlength="10"></td> ';
echo ' <td class="noborder"><INPUT type="image" src="../img/go.gif">
</FORM></td>';
echo '</tr></table><center>';
require_once '../Common/dashboard2.php';
echo '<br>';
colourkey();

$result = mysql_query("SELECT * FROM tblJobs where Closed!='checked' AND Private!='checked' AND Project='Helpdesk' AND Status!='Delete job'");

echo '<FORM action="publicfilter.php" method="POST">';
echo '<TABLE width="100%" cellpadding=0 border="1"  style="border: 1px solid #000000;">';
echo '<tr bgcolor="'.$colourtoprow.'" style="border: 1px solid #000000;"><td>Log Number</td><td>Due Date
</td><td>Assigned to</td><td>Requestor</td><td>Subject</td><td>Proirty</td><td>Status</td></tr>';
echo '<tr><td><input type=text name=lognumber size="8" value='.$_POST[lognumber].'></td><td><INPUT type="text" size="8" name="due" value="'.$_POST[due].'">';
echo '</td>';
echo '<td><SELECT name="assigned">';
echo '<option>'.$_POST[assigned].'</option><option> </option>';
echo '<option>%</option>';
echo '<option>Not Assigned</option>';
genOperator();
echo '</select></td>';
echo '<td><input type=text name=requestor value='.$_POST[requestor].'>';
echo ' </td><td><input type=text name=subject size="70" value="'.$_POST[subject].'"></td><td><select name=proirty><option>'.$_POST[proirty].'</option>';
echo '<option></option>';
echo '<option>%</option>';
genProirty();
echo '</td>';
echo '<INPUT type="hidden" name="line"><td><select name=status><option>'.$_POST[status].'</option><option></option><option>%</option>';
genStatus();
echo '</td><td><INPUT type="submit" value="Go"></td></tr>';
while($row = mysql_fetch_array($result))
  {
   if($row[Closed]=='checked')
{
$row[Closed]='Closed';
}
else
{
$row[Closed]='Open';
}
  echo '<tr ';
  colourjobs();
  echo' id="row'.$i.'" onMouseOver="row'.$i.'.style.backgroundColor=\'#F0F0F0\';" onmouseout="row'.$i.'.style.backgroundColor=\''.$colour.'\';" onclick="location.href=\'publicview.php?l='.$row['LogNumber'] .' \'"><td>'.$row['LogNumber']. "</a></td><td>" . $row['Due'].'</td>'.'<td>'.$row[Assigned].'</td><td>'.$row['Requestor'].'</td><td>'.$row[Subject].'</td>'.'<td>'.$row[Proirty].'</td>'.'<td>'.$row[Status].'</td></tr>';
  $i=$i+1;

  }
echo '</TABLE> </FORM>';

#echo '<h2><center>In progress jobs</h2><p><center>';
#require_once "inpdashboard.php";
echo '<a href="../system/public.php">Back</a><br>';
require_once '../Common/footer.php';
mysql_close();
?>